<?php
$data = [
    ['Name' => 'John', 'Age' => 25, 'City' => 'New York'],
    ['Name' => 'Jane', 'Age' => 30, 'City' => 'Los Angeles'],
    ['Name' => 'Mike', 'Age' => 35, 'City' => 'Chicago']
];
?>

<!-- 风格属性 -->
<style>
    table {
        background-color: green;
        text-align: center;
        width:555
    }
    /* 标题 */
    table th {
        background-color: #ff0ff0;
    }
    /* 数据 */
    table td {
        background-color: #0ff0ff;
    }
</style>

<!-- 边框属性 -->
<table border="1" cellspacing="2" > <!-- 使用border属性添加边框 -->
    <tr>
        <th>Name</th>
        <th>Age</th>
        <th>City</th>
    </tr>
    <?php foreach ($data as $row): ?>
    <tr>
        <td><?= htmlspecialchars($row['Name']) ?></td>
        <td><?= htmlspecialchars($row['Age']) ?></td>
        <td><?= htmlspecialchars($row['City']) ?></td>
    </tr>
    <?php endforeach; ?>
</table>

<!-- http://47.96.22.83:8187/tphp/tstype.php -->
